package com.neuedu.hw20190214;

public class HourlyEmployee extends ColaEmployee {
    // 成员变量
    private double hourlySalary;  // 时薪
    private double monthHours;   // 工作小时数

    // 行为方法

    @Override
    public Double getSalary(int month) {
        Double mySalary=hourlySalary*monthHours;
        if (this.monthHours>160){
            mySalary+=(monthHours-160)*0.5*hourlySalary;
        }
        return mySalary+=super.getSalary(month);
    }

    //自定义构造方法
    public HourlyEmployee(String empName, int empBirthdayMonth, double hourlySalary, double monthHours) {
        super(empName, empBirthdayMonth);
        this.hourlySalary = hourlySalary;
        this.monthHours = monthHours;
    }
    //显示默认构造方法

    public HourlyEmployee() {
    }

    //setter和getter方法

    public double getHourlySalary() {
        return hourlySalary;
    }

    public void setHourlySalary(double hourlySalary) {
        this.hourlySalary = hourlySalary;
    }

    public double getMonthHours() {
        return monthHours;
    }

    public void setMonthHours(double monthHours) {
        this.monthHours = monthHours;
    }
}
